package file;
import java.io.*;

public class FileInputOutputStream {
	public static void main(String[] args) {
		int i, len = 0;
		InputStream in = null;
		OutputStream out = null;

		try {
			in = new FileInputStream(new File("test.txt"));
			out = new FileOutputStream(new File("test_copy.txt"), true);
			
		} catch (FileNotFoundException e) {
			System.out.println(e);
		} catch (IOException e) {
			System.out.println(e);
		}

		try {
			while ((i = in.read()) != -1) {
				out.write(i);
				len++;
			}
			
			in.close();
			out.close();
			System.out.println(len + " bytes 복사성공!");
			
		} catch (IOException e1) {
			System.out.println(e1);
		}
	}
}
